package thread;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

/*
使用匿名内部类完成线程的两种创建方法
 */
public class ThreadDemo3 {
    public static void main(String[] args) {
        //继承thread  重写run方法
        Thread t1 = new Thread(){
            public void run(){
                for (int i = 0; i <10; i++) {
                    System.out.println("修电脑");
                }
            }
        };

        //实现Runnable接口
        Runnable r1 = new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    System.out.println("隔壁老王");
                }
            }
        };
        Thread t2 = new Thread(r1);
            t1.start();
            t2.start();

    }

}
